# Author:Zhang Yu


import paramiko

private_key = paramiko.RSAKey.from_private_key_file("id_rsa")
# 创建ssh对象

ssh =paramiko.SSHClient()
# 允许不在know_hosts文件中的主机
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname="192.168.200.217", port=22, username="sjcq", pkey=private_key)
stdin,stdout,stderr = ssh.exec_command("df")
result = stdout.read()
print(result.decode())
ssh.close()